/*
*
*培训模块接口
*
*/
angular.module("knowledgebaseS", ["Common"]).service('RequestTrainService', ['Restangular', '$http', '$rootScope', function (Restangular, $http, $rootScope) {



    this.resitTask = function (params) {
        return Restangular.one("stage").customPOST({ name: "My Message" }, "resitTask", params);
    }

    //修改学时时间
    this.modifyUserStudy=function(params){
        return Restangular.one("coursetime").customPOST({ name: "My Message" }, "modifyUserStudy", params);
   }
    //添加学员记录
    this.addCourseRecord=function(params){
         return Restangular.one("coursetime").customPOST({ name: "My Message" }, "addCourseRecord", params);
    }

    //添加任务记录
    this.modifyArrayStudy=function(params){
        return Restangular.one("coursetime").customPOST({ name: "My Message" }, "modifyArrayStudy", params);
    }

    //判断直播间参数
    this.liveBroadcast = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "liveBroadcast", params);
    };
    //下载直播视频
    this.generateVideo = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "generateVideo", params);
    };


    //查询课程里绑定的问卷
    this.findBinding = function (params) {
        return Restangular.one("questionnaire").customPOST({ name: "My Message" }, "findBinding", params);
    };
    //为课程添加问卷
    this.AssessRelation = function (params) {
        return Restangular.one("questionnaire").customPOST({ name: "My Message" }, "AssessRelation", params);
    };
    

//*****************************************************************************************************/
	//url转存为知识库文件
    this.saveUload = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "saveUload", params);
    }
    //课程或知识库导出
    this.prescriptionImport = function (params) {
        return Restangular.one("report").customPOST({ name: "My Message" }, "exportReport", params);
    };
    //查询课程，试卷，任务的负责人
    this.findRelationPeople = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "findRelationPeople", params);
    };

    //导入任务参与人员
    this.ExcelImport = function (params) {
        return $rootScope.upurl + "/import/ExcelImport" + params;
    }

    //修改任务里的json
    this.UpdateStageJson = function (params) {
        return Restangular.one("stage").customPOST({ name: "My Message" }, "UpdateStageJson", params);
    };
    //删除注册审核
    this.delRegister = function (params) {
        return Restangular.one("registerAudit").customPOST({ name: "My Message" }, "delRegister", params);
    };
    //审核注册审核
    this.upRegesterAudit = function (params) {
        return Restangular.one("registerAudit").customPOST({ name: "My Message" }, "upRegesterAudit", params);
    };
    //查询注册审核
    this.findRegisterAuditList = function (params) {
        return Restangular.one("registerAudit").customPOST({ name: "My Message" }, "findRegisterAuditList", params);
    };
    //查询组织架构变更审核
    this.findOrgAuditList = function (params) {
        return Restangular.one("orgAudit").customPOST({ name: "My Message" }, "findOrgAuditList", params);
    };
    //删除
    this.delAudit = function (params) {
        return Restangular.one("orgAudit").customPOST({ name: "My Message" }, "delAudit", params);
    };
    //提交
    this.saveOrgAudit = function (params) {
        return Restangular.one("orgAudit").customPOST({ name: "My Message" }, "saveOrgAudit", params);
    };
    //添加外部试卷
    this.saveOrEditPapers = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "saveOrEditPapers", params);
    };
    //删除外部试卷
    this.delPapers = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "delPapers", params);
    };
    //查询外部试卷
    this.findEexternalPage = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "findEexternalPage", params);
    };

    //删除成绩
    this.delScore = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "deleteScore", params);
    };
    //新增或编辑成绩
    this.saveOrEditScore = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "saveOrEditScore", params);
    };
    //查询外部试卷的成绩（管理端）
    this.findScorePage = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "findScorePage", params);
    };
    //查询外部试卷的成绩（学员端）
    this.findUserScorePage = function (params) {
        return Restangular.one("external").customPOST({ name: "My Message" }, "findUserScorePage", params);
    };


    //查询单个试卷里所有人员的拍照
    this.paperPhoto = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "paperPhoto", params);
    };

    //查询单个人某张试卷里的照片
    this.findFaceInfoPage = function (params) {
        return Restangular.one("face").customPOST({ name: "My Message" }, "findFaceInfoPage", params);
    };
    //任务报名状态查询
    this.getEnrollInfo = function (params) {
        return Restangular.one("enroll").customPOST({ name: "My Message" }, "getEnrollInfo", params);
    };
    //任务报名
    this.addEnrollInfo = function (params) {
        return Restangular.one("enroll").customPOST({ name: "My Message" }, "addEnrollInfo", params);
    };
    //任务报名审核列表
    this.findEnrollPage = function (params) {
        return Restangular.one("enroll").customPOST({ name: "My Message" }, "findEnrollPage", params);
    };
    //任务审核删除
    this.modifyExamine = function (params) {
        return Restangular.one("enroll").customPOST({ name: "My Message" }, "modifyExamine", params);
    };
    //查询成绩列表
    this.findExamScore = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "findExamScore", params);
    };
    //修改成绩列表
    this.updateScore = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "updateScore", params);
    };




    //上传scrom课件
    this.uploadScrom = function (params) {
        return $rootScope.fileurl + "/file/uploadScrom" + params;
    }

    //错题统计---查询最后统计日期和人
    this.findErrorExamList = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "findErrorExamList", params);
    };
    //错题统计---查询统计列表
    this.findErrorExam = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "findErrorExam", params);
    };
    //错题统计---重新统计
    this.errorExam = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "errorExam", params);
    };
    /**
    *  获取已考次数
    */
    this.getExamNum = function (params) {
        return Restangular.one("score").customPOST({ name: "My Message" }, "getExamNum", params);
    }
    //新增自定义报表
    this.addOrEditStatistics = function (params) {
        return Restangular.one("statistics").customPOST({ name: "My Message" }, "addOrEditStatistics", params);
    };
    //导出自定义报表
    this.exportStatistics = function (params) {
        return Restangular.one("statistics").customPOST({ name: "My Message" }, "exportStatistics", params);
    };
    //查询单个自定义报表数据
    this.findStatisticsTable = function (params) {
        return Restangular.one("statistics").customPOST({ name: "My Message" }, "findStatisticsTable", params);
    };
    //查询自定义报表
    this.findTable = function (params) {
        return Restangular.one("statistics").customPOST({ name: "My Message" }, "findTable", params);
    };
    //删除自定义报表
    this.deleteStatistics = function (params) {
        return Restangular.one("statistics").customPOST({ name: "My Message" }, "deleteStatistics", params);
    };
    //查询班级列表
    this.findGradeInfoAll = function (params) {
        return Restangular.one("grade").customPOST({ name: "My Message" }, "findGradeInfoAll", params);
    };
    //基地查询
    this.findTrainbase = function (params) {
        return Restangular.one("trainbase").customPOST({ name: "My Message" }, "findTrainbase", params);
    };

    //激活直播
    this.openOrCloseLiveApi = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "openOrCloseLiveApi", params);
    };
    //创建直播间：小鱼
    this.CreateLiveApi = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "CreateLiveApi", params);
    };
    //创建直播间：edu
    this.CreateLive = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "CreateLive", params);
    };
	//创建直播间：百度
    this.saveLive = function (params) {
        return Restangular.one("live").customPOST({ name: "My Message" }, "saveLive", params);
    };
    //跳转直播
    this.getTiket = function (params) {
        return Restangular.one("/live").customPOST({ name: "My Message" }, "getTiket", params);
    }
    //问卷列表 
    this.findQuestionnairePage = function (params) {
        return Restangular.one("questionnaire").customPOST({ name: "My Message" }, "findQuestionnairePage", params);
    };
    /*****************************************************证书*******************************************************/
    //证书列表
    this.findCertificatePage = function (params) {
        return Restangular.one("certificate").customPOST({ name: "My Message" }, "findCertificatePage", params);
    };
    //新增编辑证书
    this.EditCertificate = function (params) {
        return Restangular.one("certificate").customPOST({ name: "My Message" }, "EditCertificate", params);
    };
    //删除证书
    this.delCertificate = function (params) {
        return Restangular.one("certificate").customPOST({ name: "My Message" }, "delCertificate", params);
    };
    //上传模板
    this.uploadFtl = function (params) {
        return $rootScope.userurl + "/template/uploadFtl" + params;
    }
    //生成证书模板
    this.TemplateGeneration = function (params) {
        return Restangular.one("certificate").customPOST({ name: "My Message" }, "TemplateGeneration", params);
    };

    //查询企业的文件详细记录流量   
    this.findFileFlowDetailedPage = function (params) {
        return Restangular.one("/flowlog").customPOST({ name: "My Message" }, "findFileFlowDetailedPage", params);
    }
    //导出excel
    this.taskExport = function (params) {
        return Restangular.one("stage").customPOST({ name: "My Message" }, "taskExport", params);
    };
    //删除导出数据
    this.delPerson = function (params) {
        return Restangular.one("PersonnelManagement").customPOST({ name: "My Message" }, "delPerson", params);
    };
    /*
    *查询学员的任务阶段内容
    * request
    *   courseids true string 课程id，以，做分隔
    *   paperids true string 试卷id,以，做分隔
    *   upids true string 文件id,以，做分隔
    *   knowledgeids true string 知识结构id,以，做分隔
    *   pageIndex true string 当前页码
    *   pageSize true string 当前显示条数
    * response
    *       errorcode
    *       datas
    */
    this.findArrangeStage = function (params) {
        //        return $http({
        //            url: "/api/stutrainingtaskcourelist.json",
        //            method: 'GET'
        //        });
        return Restangular.one("stage").customPOST({ name: "My Message" }, "findArrangeStage", params);
    }
    //查询当前任务的已完成的课程、试卷id
    this.findOneProgress = function (params) {
        return Restangular.one("/stage").customPOST({ name: "My Message" }, "findOneProgress", params);

    }
    // 获取日志
    this.findLog = function (params) {
        return Restangular.one("CommitLog").customPOST({ name: "My Message" }, "findLog", params);

    }
    /** 请求超级报表
    */
    this.GetUserData = function (params) {
        return $http({ url: "/api/statistic.json", data: params });
    }
    /**
    重定向课程播放页
    */
    this.redirect = function (params) {
        return Restangular.one("dispatcher").customPOST({ name: "My Message" }, "redirect", params);
    }
    /**
    人员悬浮框
    */
    this.PersonnelGetIframeInfo = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelGetIframeInfo", params);
    }
    /**
    重定向课程播放页
    */
    this.redirect = function (params) {
        return Restangular.one("dispatcher").customPOST({ name: "My Message" }, "redirect", params);
    }
    /********************************************任务进度统计*************************************************/
    //查询学员进度
    this.findArrangeProgress = function (params) {

        return Restangular.one("stage").post( "findArrangeProgress",$.param(params));
    }
    /********************************培训任务*********************************/
    /**
    *   request:
    *       create_id true string 登录人id
    *       org_ID true string 登录人企业id
    *       powerLV true string 权限id
    *       start_time false string 开始时间
    *       end_time false string 结束时间
    *       name false string 搜索内容、（知识结构名称或拼音）
    *       searchUserId false string 搜索培训人员 （预留字段）
    *       pageIndex false string 起始下标
    *       pageSize false string 页数
    *   response:
    *       errorcode:
    *       datas 任务集合
    */
    this.findstage = function (params) {
        return Restangular.one("stage").customPOST({ name: "My Message" }, "findstage", params);
    }
    /*
    *   查询知识架构负者人
    *   request
    *   userId false string 搜索负责人id
    *  knowledge   当前查询的知识架构id集合
    *    {knowledge_Id:"fda54gdsa"},{knowledge_Id:"432ga4g5d3sa"},{knowledge_Id:"21fagakh"}
    */
    this.findUserByKnowledge = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "findUserByKnowledge", params);
    }
    /**
    *   删除培训任务
    *   arrangeIds false string 12,213,54,6 任务id
    * response
    *   errorcode true string 状态码:0 成功 1失败，34.删除的知识架构存在课程
    *   errorMsg true string 错误消息
    *   numCount true string 受影响的行数   
    */
    this.deleteArrange = function (params) {
        return Restangular.one("stage").customPOST({ name: "My Message" }, "deleteArrange", params);
    }
    /** 
    * 添加删除任务
    * request
    *      id false string 任务id
    *      name false string 任务名称
    *      org_ID false string 企业id
    *      org_Name false string 企业名称
    *      create_id false string 用户id
    *      is_public false boolean true,是，false，不是 是否公开 全部人员可参与
    *      start_Date false number Date 开始时间
    *      end_Date false string Date 结束时间
    *      userList false string userIds
    *      userGroup false string
    *      userOrganization false string
    *      userRole false string
    *      arragetype false string 任务json
    *      date_formate_time false string 时间
    *      qualified false boolean true,是，false，不是 合格才能进入下一阶段
    *      date_formate false string 0，不限时间，1.固定周期，2，固定日期，3.固定天数 时间类型
    *      courser_count false string 课程数 课程数
    *      start_time false string 开始时间 点
    *      end_time false string 结束时间 点
    *      fine_time false string true,是，false 否 是否需要精细时间
    *      state false string （预留，是分配0还是自主报名1）
    *      qualified_condition false string 1.学满学时，2.考核通过 合格条件
    *      qualified_pass false number 通过考核分数、时间（分钟）
    * response
    *   errorcode
    *   errorMsg
    *
    */
    this.addUpdateArrange = function (params) {
        //            return $http({
        //                url: $rootScope.upurl + "/stage/addUpdateArrange",
        //                method: 'post',
        //                params
        //            });
        //return Restangular.one("stage").post( "addUpdateArrange",$.param(params));

         return Restangular.one("stage").customPOST({ name: "My Message" }, "addUpdateArrange", params);
    }

    /********************************知识机构*********************************/
    /*
    *   查询知识架构列表
    *   request
    *   userId false string 搜索负责人id
    *  orgId false string 登录人企业id
    *  powerLV false string 权限id
    *  startDate false string 开始时间
    *  endDate false string 结束时间
    *  searchName false string 搜索内容、（知识结构名称或拼音）
    *  knowledge_Id false string 查询子节点参数
    *   respose
    *   errorCode true string 0成功，1失败
    *   datas true array[object]  知识结构集合
    *    
    */
    this.findKnowledgeList = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "findKnowledgeList", params);
    }
    /*
    *   查询知识架构模版列表
    *   request
    *   userId false string 搜索负责人id
    *  orgId false string 登录人企业id   
    *   respose
    *   errorCode true string 0成功，1失败
    *   datas true array[object]  知识结构集合
    *    
    */
    this.findhasId = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "findhasId", params);
    }
    /**
    *   获取课程列表 - 知识选择器
    *   userid true string 用户id
    *   orgid true string 企业id
    *   powerLV true string 用户等级
    *   searchText false string 搜索内容
    *   searchType false string 筛选类型（1.文件名称2.文件大小3.文件上传时间4.文件修改时间）
    *   pageIndex false string 当前页码
    *   pageSize false string 当前显示条数
    *   startDate false string 开始时间
    *   endDate false string 结束时间
    *   screenText false string 筛选内容(2和3都用此筛选)
    *   screenType false string 筛选类型(1.录入时间查询 2.教师查询 3.操作人查询)
    *   knowledgeId false string 知识机构id(选中某一节点，查询它下面所有课程)
    */
    this.findCourseinfo = function (params) {
        return Restangular.one("course").post( "findCourseinfo",$.param(params));
    }
    /**
    * 试卷查询 - 知识选择器
    *   userid false string 用户id
    *   orgid false string 企业id
    *   powerLV false string 用户角色等级
    *   searchText false string 筛选内容
    *   knowledgeId false string 知识结构id
    * response
    *   errorcode : 
    *  datas :返回试卷集合
    */
    this.findExamName = function (params) {
        return Restangular.one("exampaper").customPOST({ name: "My Message" }, "findExamName", params);
    }
    /**
    题目查询 - 知识选择器
    
    */

    this.findQuestionBySelectAndTrimToKnowledge = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "findQuestionBySelectAndTrimToKnowledge", params);
    }
    //添加、修改、移动
    this.addOrUpKnowledge = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "addOrUpKnowledge", params);
    }
    //删除
    this.delKnowledge = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "delKnowledge", params);
    }
    //查询模板  
    this.findModelList = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "findModelList", params);
    }
    //保存模板添加  
    this.addModelKnowledge = function (params) {
        return Restangular.one("knowledge").customPOST({ name: "My Message" }, "addModelKnowledge", params);
    }
    /*
    * 查询文档视频
    *   userid false string 用户id
    *   fid false string 父节点
    *   orgid false string 企业id
    *   searchText false string 筛选内容
    *   searchType false string 筛选类型
    *   pageIndex false string 当前页码
    *   pageSize false string 当前页码
    *   fileType false string 当前显示条数
    *   orderby false string folder:文件夹 空：所有
    *   powerLV false string 用户角色等级
    *   type false string 1.文档、2.视频
    */
    this.queryFileType = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "queryFileType", params);
    }


    /********************************知识库*********************************/
    this.wenjiancanshu = function (params) {
        return Restangular.one("/api/zhishiku").customPOST({ name: "My Message" }, "wenjianchuanshu.json", params);
    }

    //获取文件列表
    /*
    *   userid true string 用户ID
    *   orgid true string 企业ID（查询企业文件）
    *   searchText false string 搜索内容
    *   searchType false string 筛选类型（1.文件名称2.文件大小3.文件上传时间4.文件修改时间）
    *   pageIndex false string 当前页码
    *   pageSize false string 当前显示条数
    *   fid true string 父目录 的id
    *   tagid false string 标签id
    *   fileType false string folder:文件夹 空：所有
    *   Shares true string 0，是 是否是共享文件
    *   orderby false string desc倒序 倒序
    *   powerLV false string 用户角色
    */
    this.getuserfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "getuserfile", params);
    }

    //删除文件
    this.delfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "delfile", params);
    }
    //获取文件夹列表
    this.MoveFolder = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "MoveFolder", params);
    }

    //上传文件
    this.upfiles = function (params) {
        return $rootScope.upurl + "/Kapi/upfiles" + params;
    }

    //上传题库图片
    this.upTKImg = function (params) {
        return $rootScope.questionDomain + "/my/ajaxuploadfile" + params;
    }

    //创建文件夹
    this.CreateFolder = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "CreateFolder", params);
    }

    //修改文件名称（含文件夹）
    this.UpFileName = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "UpFileName", params);
    }

    //修改,创建网页名称
    this.AddEditURLCollection = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AddEditURLCollection", params);
    }

    //创建记事本
    this.AddNotepad = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AddNotepad", params);
    }

    //问答添加
    this.AddAsk = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AddAsk", params);
    }

    //提交回答
    this.UpdateAsk = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "UpdateAsk", params);
    }

    //问答获取
    this.GetAsk = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "GetAsk", params);
    }

    //获取历史版本
    this.History_List = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "HistoryList", params);
    }

    //修改文件属性
    this.upfileinfo = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "Upfileinfo", params);
    }

    //移动/复制文件
    this.mvfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "mvfile", params);
    }

    //删除文件历史版本
    this.delcfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "delcfile", params);
    }

    //设置文件主版本
    this.SetMainVersion = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "SetMainVersion", params);
    }

    //查询共享文件夹
    /*
    this.getSharelist = function (params) {
    return $http({
    url: '/api/test/getSharelist.json',
    method: 'GET'
    });
    //return Restangular.one("kapi").customPOST({ name: "My Message" }, "getSharelist", params);
    }
    */
    /******************************************标签信息处理******************************************/

    //获得个人标签列表
    this.gettaglist = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "gettaglist", params);
    }
    //根据文件id获取文件标签列表
    this.downloadfile = function (params) {
        // return $rootScope.upurl + "/Kapi/DownloadFile" + params;
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "DownloadFile", params);
        //return Restangular.one("Kapi").customPOST({ name: "My Message" }, "DownloadFile", params);
    }
    //请求文件服务器下载
    this.filedown = function (params) {
        return $rootScope.fileurl + "/file/filedown" + params;
    }
    //请求文件服务器下载——针对记事本，问答，网页收藏
    this.downloadfile2 = function (params) {
        return $rootScope.upurl + "/Kapi/DownloadFile" + params;
    }
    //修改标签名称
    this.UpTagName = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "UpTagName", params);
    }

    //根据文件id获取文件标签列表
    this.getfiletag = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "getfiletag", params);
    }

    //更新文件
    this.updatafilechild = function (params) {
        return $rootScope.upurl + "/Kapi/UpdataFileChild" + params;
    }
    //标签数据源
    this.getOldTagList = function () {
        return [{ "index": "1", "tagid": "01c9cfcb-ffec-4778-be6f-31e633czo33a", "tagname": "红色", "tagcolor": "#icon-biaoqianhongse" },
                                           { "index": "2", "tagid": "01c9cfcb-ffec-4778-abcd-31e6321zo33b", "tagname": "橙色", "tagcolor": "#icon-biaoqianchengse" },
                                           { "index": "3", "tagid": "01c9cfcb-ffec-3208-abcd-31e633czo33c", "tagname": "黄色", "tagcolor": "#icon-biaoqianhuangsese" },
                                           { "index": "4", "tagid": "01c1259cb-ffec-4778-abcd-31e633czo33d", "tagname": "绿色", "tagcolor": "#icon-biaoqianlvse" },
                                           { "index": "5", "tagid": "05bae156-9d94-482b-a120-86e694e40abe", "tagname": "蓝色", "tagcolor": "#icon-biaoqianlanse" },
                                           { "index": "6", "tagid": "078cbeeb-f78f-312e-9de0-9efe1ee766af", "tagname": "紫色", "tagcolor": "#icon-biaoqianzise" },
                                           { "index": "7", "tagid": "08283666-15b4-4135-b0aa-3ecfdeed6e7g", "tagname": "灰色", "tagcolor": "#icon-biaoqianhuise"}];
    }

    //根据文件id获取文件权限列表
    this.getfileShare = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "getfileShare", params);
    }

    //查询企业共享文件
    this.getSharelist = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "getSharelist", params);
    }

    //记录文件预览次数
    this.PreviewNumber = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "PreviewNumber", params);
    }



    /***********************************************运营页面相关访问接口***********************************************/

    //    查询文件共享情况
    /*
    fileids：文件id(多个逗号分开)
    pageIndex：当前页码
    pageSize：当前显示条数
    powerLV：用户角色
    userid：用户ID
    */
    this.FileSharing = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "FileSharing", params);
    }
    //    共享查询企业名称
    /*
    files：文件ID（多个逗号分开）
    searchText：筛选内容
    userid：用户ID
    powerLV：用户角色
    */
    this.GetOrgNameShar = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "GetOrgNameShar", params);
    }
    //    查询已共享给企业的文件
    /*
    organization_ID:企业ID
    powerLV:用户角色
    userid：用户ID
    */
    this.AlreaSharOrgfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AlreaSharOrgfile", params);
    }
    //    选择文件共享给企业
    /*
    organization_ID:企业ID
    fileids:文件id(多个逗号分开)
    powerLV:用户角色
    userid:用户ID
    */
    this.setSharfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "setSharfile", params);
    }
    //    删除企业共享文件
    /*
    fileids：文件id(多个逗号分开)
    organization_ID：企业ID
    fileType：文件类型（0文件 1文件夹）
    deltype：删除类型（0删除文件或文件夹 1删除已选择共享给企业的文件）
    powerLV：用户角色
    userid：用户ID
    */
    this.delSharfile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "delSharfile", params);
    }

    //查询运营者共享给企业的文件（知识库中呈现）
    /*
    orgid：企业id
    pageIndex：当前页码
    pageSize：当前显示条数
    */
    this.AlreaSharOperatefile = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AlreaSharOperatefile", params);
    }

    //文件转码
    this.AgainTranscoding = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "AgainTranscoding", params);
    }

    //    添加 / 修改课程
    this.AddNoCourseinfo = function (params) {
        return Restangular.one("course").post( "AddNoCourseinfo",$.param(params));
    }

    //查询课程详细
    this.findCourseDetailed = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "findCourseDetailed", params);
    }

    //查询课程
    this.findCourseinfo = function (params) {
        return Restangular.one("course").post( "findCourseinfo",$.param(params));
    }

    //删除课程
    this.delCourse = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "delCourse", params);
    }

    //查询人员学习记录
    /*
    courseid:课程id
    organizationID:组织机构id
    userGroupID:用户组id
    userRoleID:角色id
    pageIndex:当前页数
    pageSize:当前显示条数
    */
    this.peopleLearn = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "peopleLearn", params);
    }

    //    查询课程的相关信息
    /*
    courseid:课程id
    */
    this.courseRelevant = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "courseRelevant", params);
    }
    //    30天内课程观看人数的统计
    /*
    courseid:课程id
    startDate:开始时间
    endDate:结束时间
    */
    this.courseStatistics = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "courseStatistics", params);
    }
    //    考试信息统计
    /*
    paperid:试卷id
    type:是否合格,1合格 2.不合格
    fraction:分数
    organizationID:组织机构id
    userGroupID:用户组id
    userRoleID:角色id
    orderby:默认desc    倒序
    pageIndex:当前页码
    pageSize:当前条数
    */
    this.paperStatistics = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "paperStatistics", params);
    }
    //    线下信息统计
    /*
    csid:章节id
    type:1.已报名 2.已到场 3.未到场
    organizationID:组织架构id
    userGroupID: 用户组id
    userRoleID:角色id
    orderby: 默认desc    倒序（根据报名时间排序）
    pageIndex: 当前页码
    pageSize:  当前页数

    */
    this.lineStatistics = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "lineStatistics", params);
    }

    //    视频、文档信息统计
    /*
    csid: 章节id
    type: 1.合格 2.未合格
    time:  要求学习时间
    organizationID: 组织架构id
    userGroupID: 用户组id
    userRoleID:角色id
    orderby:默认desc    倒序
    pageIndex: 当前页码
    pageSize:当前页数
    */
    this.videoStatistics = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "videoStatistics", params);
    }

    //    课程章节列表
    /*
    courseid:课程id 
    */
    this.chapterList = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "chapterList", params);
    }

    //    课程章节列表
    /*    
    csid:章节id
    cstype:章节类型(1.视频 2.文档 3.考试(测试)id 4.题库 5.线下 6.直播)
    */
    this.chapterQuantity = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "chapterQuantity", params);
    }
    //    //课程模板生成
    //    /*
    //    course_id：课程编号 ID 
    //    */
    //    this.courseGeneratingTemplate = function (params) {
    //        return Restangular.one("course").customPOST({ name: "My Message" }, "courseGeneratingTemplate", params);
    //    }


    //上传课程封面
    this.uploadCover = function (params) {
        return $rootScope.fileurl + "/file/uploadCover" + params;
    }



    /*******************************************考试列表**************************************************/
    //试卷列表
    this.findByPaperPageSelectAndTrim = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "findByPaperPageSelectAndTrim", params);
    }
    //试卷列表
    this.findPaperPage = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "findPaperPage", params);
    }
    //新增试卷
    this.savePaper = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "savePaper", params);
    }

    //新增随机卷
    this.savePaperByRandom = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "savePaperByRandom", params);
    }

    //删除试卷
    this.delPaper = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "delPaper", params);
    }

    //获取试卷对象
    //删除试卷
    this.findPaperByid = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "findPaperByid", params);
    }

    //根据知识结构id题型id难度查询题目数
    this.findNumberByWhere = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "findNumberByWhere", params);
    }

    // 题库导入试卷题目
    this.questionsToPaper = function (params, params1) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "questionsToPaper", params);
    }
    //查询题库列表

    this.findQuestionBySelectAndTrim = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "findQuestionBySelectAndTrim", params);
    }

    //删除题目
    this.questionDel = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "questionDel", params);
    }

    //增加题目
    this.questionSaveOrUpdate = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "questionSaveOrUpdate", params);
    }

    //根据题目id查询题目
    this.questionFindByid = function (params) {
        return Restangular.one("questionLook").customPOST({ name: "My Message" }, "questionFindByid", params);
    }

    //根据试卷id 重新生成静态页面
    this.IcreateHtml = function (params) {
        return Restangular.one("paper").customPOST({ name: "My Message" }, "IcreateHtml", params);
    }

    //根据试卷id 查看试卷成绩
    this.paperStatistics = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "paperStatistics", params);
    }

    //查询课程关联的知识架构
    this.findKnowledgeByCourse = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "findKnowledgeByCourse", params);
    }
    /**
    查询人员对应的课程的小节学习记录 
    courseId 
    课程id

    userId
    登录用户id

    startDate
    开始时间

    endDate
    结束时间

    pageIndex
    当前页数

    pageSize
    当前显示条数

    stuId
    学员id
        
    **/
    this.findSectionByCidUid = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "findSectionByCidUid", params);
    }

    // 视频转码
    this.vedioTranscoding = function (params) {
        return Restangular.one("Kapi").customPOST({ name: "My Message" }, "vedioTranscoding", params);
    }
    /********************************************课程共享**************************************************/

    //查询任务里未过期的课程
    this.findExpireState = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "findExpireState", params);
    }
    //查询单企业的所有共享课程
    this.findOrgAllShareList = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "findOrgAllShareList", params);
    }
    //查询单企业的所有共享课程（选择器）
    this.findShareCourseinfo = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "findShareCourseinfo", params);
    }
    //查询已运营的企业
    this.findOwnerOrg = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "findOwnerOrg", params);
    }
    //添加共享
    this.addShare = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "addShare", params);
    }
    //删除共享里的课程
    this.deleteOrgShare = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "deleteOrgShare", params);
    }
    //查询已共享信息列表
    this.findShareList = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "findShareList", params);
    }
	 //删除共享里的课程
    this.deleteShareCourse = function (params) {
        return Restangular.one("/shareCourse").customPOST({ name: "My Message" }, "deleteShareCourse", params);
    }
} ]);
